<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://unpkg.com/fabric@4.6.0/dist/fabric.min.js"></script>
</head>
<body>
  <!-- <img src="https://img1.baidu.com/it/u=3206351602,2714439067&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500" alt=""> -->
  <canvas width="1000" height="600" id="canvas" style="border: 1px solid #ccc;"></canvas>
  <script>
    // 绘制一个 canvas
    const canvas = new fabric.Canvas('canvas')
    
    canvas.setBackgroundColor(
      {
      source: "https://img1.baidu.com/it/u=3206351602,2714439067&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500",
      repeat: 'repeat'
      },
      canvas.renderAll.bind(canvas)
    )
  </script>
</body>
</html>